import java.util.StringTokenizer;

class P10377 {

	private static boolean[][] grid;

	public static void main(String[] args) {
		int cases = Integer.parseInt(readLn());

		for (int k = 0; k < cases; k++) {
			readLn();
			StringTokenizer st = new StringTokenizer(readLn());
			int y = Integer.parseInt(st.nextToken());
			int x = Integer.parseInt(st.nextToken());
			process(x, y);
			
			if (k + 1 != cases) System.out.println();
		}
	}

	private static void process(int x, int y) {
		grid = new boolean[y][x];
		for (int k = 0; k < y; k++) {
			String line = readLn();
			for (int j = 0; j < x; j++) {
				if (line.charAt(j) == '*') {
					grid[k][j] = false;
				} else {
					grid[k][j] = true;
				}
			}
		}
		StringTokenizer st = new StringTokenizer(readLn());

		int y0 = Integer.parseInt(st.nextToken());
		int x0 = Integer.parseInt(st.nextToken());

		processRobot(x0 - 1, y0 - 1, 'N');
		
	}

	private static void processRobot(int x0, int y0, char o) {
		int x = x0;
		int y = y0;
		while (true) {
			
			String path = readLn();
			int length = path.length();
			for (int k = 0; k < length; k++) {
//				System.out.println("-------------");
//				print(grid, x, y);
//				System.out.println("-------------");
				char c = path.charAt(k);
				if (c == 'Q') {
					System.out.println((y + 1) + " " + (x+1) + " " + o);
					return;
				}

				if (c == 'F') {
					int[] xy = goTo(x, y, o);
					x = xy[0];
					y = xy[1];
				} else if (c == 'R' || c == 'L')  {
					o = turn(o, c);
				}
			}
		}
		// System.out.println(x + " " + y + " " + o );
	}

	private static void print(boolean[][] grid, int x, int y) {
		for (int k = 0; k < grid.length; k++) {
			for (int j = 0; j < grid[k].length; j++) {
				if (grid[k][j]) {
					if (x == j && y == k) { 
						System.out.print('O'); 
					} else {
						System.out.print(' ');
					}
				} else {
					System.out.print('X');
				}
			}
			System.out.println();
		}
		
	}

	private static char turn(char o, char c) {
		switch (o) {
		case 'N':
			if (c == 'R') {
				o = 'E';
			} else {
				o = 'W';
			}
			break;
		case 'S':
			if (c == 'R') {
				o = 'W';
			} else {
				o = 'E';
			}
			break;
		case 'E':
			if (c == 'R') {
				o = 'S';
			} else {
				o = 'N';
			}
			break;
		case 'W':
			if (c == 'R') {
				o = 'N';
			} else {
				o = 'S';
			}
			break;
		}
		return o;
	}

	private static int[] goTo(int x, int y, char o) {
		int xBack = x;
		int yBack = y;
		switch (o) {
		case 'N':
			y--;
			break;
		case 'S':
			y++;
			break;
		case 'E':
			x++;
			break;
		case 'W':
			x--;
			break;
		}

		if (grid[y][x]) {
			int[] answer = { x, y };
			return answer;
		} else {
			int[] answer = { xBack, yBack };
			return answer;
		}
	}

	private static boolean lose(int x, int y, char o) {
		int[] xy = goTo(x, y, o);
		try {
			boolean w = grid[xy[0]][xy[1]];
		} catch (Exception e) {
			return true;
		}
		return false;
	}

	static String readLn() {
		String newLine = System.getProperty("line.separator");
		StringBuffer buffer = new StringBuffer();
		int car = -1;
		try {
			car = System.in.read();
			while ((car > 0) && (car != newLine.charAt(0))) {
				buffer.append((char) car);
				car = System.in.read();
			}
			if (car == newLine.charAt(0))
				System.in.skip(newLine.length() - 1);
		} catch (java.io.IOException e) {
			return (null);
		}
		if ((car < 0) && (buffer.length() == 0))
			return (null);
		return (buffer.toString()).trim();
	}

}
